In a wide area network, some network elements may track a connection between devices. If there is no message on the connection over threshold duration, the connection may be cut off. However, a message usually needs to be sent between some devices in time (that is, the devices need to maintain a long connection), and sending of the message, for example, a message sent by a server of a push system to a client of the push system, may exceed the threshold duration. In the foregoing disconnection manner, the server may fail to deliver a message to the client in time, affecting performance of the push system.
In the prior art, to maintain a long connection, devices (for example, a server and a client) usually need to send a heartbeat message to one another. The heartbeat message is a data packet periodically sent between the two devices. However, no useful message is exchanged between the server and the client in most periods of time, resulting in a waste of network traffic resources, resources of connections, and server resources.